package cn.edu.scau.cmi.linpeiwei.controller;

import javafx.fxml.FXML;

import javafx.scene.control.Button;

import javafx.scene.text.Text;

import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import cn.edu.scau.cmi.linpeiwei.adapter.AdapterOfClass;
import cn.edu.scau.cmi.linpeiwei.adapter.AdapterOfObject;
import cn.edu.scau.cmi.linpeiwei.adapter.Target;
import javafx.event.ActionEvent;

public class AdapterController extends AnchorPane{
	@FXML
	private Button buttonC;
	@FXML
	private Button buttonO;
	@FXML
	private TextField textfield;
	@FXML
	private Text text;
	
	private Target adapterOfObject = new AdapterOfObject();
	private Target adapterOfClass = new AdapterOfClass();

	// Event Listener on Button[#button].onAction
	@FXML
	public void onEventC(ActionEvent event) {
		if(!textfield.getText().isEmpty()) {
			adapterOfClass.setPower(textfield.getText());
			text.setText(adapterOfClass.change());
		}
		
	}
	@FXML
	public void onEventO(ActionEvent event) {
		if(!textfield.getText().isEmpty()) {
			adapterOfObject.setPower(textfield.getText());
			text.setText(adapterOfObject.change());
		}
		
	}
}
